import { CHANNEL_ACTIVE, CHANNEL_LIST } from '../constants'

export default function channel(
  state = {
    list: [],
    active: 0,
  },
  action
) {
  switch (action.type) {
    case CHANNEL_LIST:
      return {
        ...state,
        list: action.payload,
      }
    case CHANNEL_ACTIVE:
      return {
        ...state,
        active: action.id,
      }
    default:
      return state
  }
}
